<template>
	<BasicModal v-bind="$attrs" z-index="1000" style="z-index:999" @register="registerModal" title="请选择学校"
		@ok="confirmSelectSchool" >
		<BasicForm @register="registerForm">

		</BasicForm>
	</BasicModal>
</template>
<script lang="ts" setup>
	import { defineComponent, ref, unref, inject } from 'vue';
	import { updateSchoolFrom } from '../CoupleUser.data';
	import { updateSchoolApi } from '../CoupleUser.api';
	import { useMessage } from '/@/hooks/web/useMessage';
	import { BasicForm, useForm } from '/@/components/Form/index';
	import { BasicModal, useModalInner } from '/@/components/Modal';
	const emit = defineEmits(['register', 'successConfirm']);
	const mainId = inject('mainId') || '';
	const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
		setModalProps({ zIndex: 1000 })
	})
	const [registerForm, { setProps, resetFields, setFieldsValue, validate }] = useForm({
		//labelWidth: 150,
		schemas: updateSchoolFrom,
		showActionButtonGroup: false,
		baseColProps: { span: 24 }

	});


	async function confirmSelectSchool() {
		let values = await validate();
		 if (unref(mainId)) {
			values['userId'] = unref(mainId);
		} 

		//提交表单
		await updateSchoolApi(values);
		closeModal();

	}
</script>

<style>

</style>